package pers.zc.activiti.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import pers.zc.activiti.event.TestEvent;

/**
 * @Annotion:
 * @ClassName: TestListenerController
 * @Author: Lin Fuyuan
 * @Date: 2019/10/29  10:57
 * @Version: 1.0
 */
@Controller
@RequestMapping("/listener")
public class TestListenerController {

    @Autowired
    private ApplicationEventPublisher publisher;
    @GetMapping("/test1")
    public void test1(){
        System.out.println("请求监听:");
        /*调用被监听的方法*/
        publisher.publishEvent( new TestEvent("323232", "linfuy","xuexiao " ));
        System.out.println("该输出在请求方法最后");
    }
}
